//
//  AdoptDetailTitleCell.m
//  PigMarket
//
//  Created by 张敬 on 2019/9/6.
//  Copyright © 2019年 pigmarket.oc. All rights reserved.
//

#import "AdoptDetailTitleCell.h"

@implementation AdoptDetailTitleCell

#pragma mark - lifecycle methods
- (void)setupUI{
    
    [self addSubview:self.titleLab];
    [self addSubview:self.tipLab];
    [self addSubview:self.detailLab];
    [self addSubview:self.discountLab];

    
}

- (void)setupLayout{
    
    
    {
        _titleLab.size = CGSizeMake(80, 42);
        _titleLab.mj_x = 15;
        _titleLab.mj_y = 0;
    }
    
    {
        _tipLab.size = CGSizeMake(200, 42);
        _tipLab.mj_x = _titleLab.right + 5;
        _tipLab.mj_y = 0;
    }
    
    {
        _detailLab.size = CGSizeMake(200, 42);
        _detailLab.mj_x = KScreenWidth - _detailLab.width - 15;
        _detailLab.mj_y = 0;
    }
    
    {
        _discountLab.size = CGSizeMake(200, 42);
        _discountLab.mj_x = _titleLab.right + 5;
        _discountLab.mj_y = 0;
    }
    
    CAShapeLayer *line = [CAShapeLayer layer];
    line.fillColor = mBackgroudColor.CGColor;
    
    UIBezierPath *path = [UIBezierPath bezierPathWithRect:CGRectMake(15, 41, KScreenWidth -30, 1)];
    line.path = path.CGPath;
    
    [self.layer addSublayer:line];
}

#pragma mark - setter methods
- (void)setType:(NSNumber *)type{
    
    if ([type integerValue] == 0) {
        _detailLab.hidden = _tipLab.hidden = NO;
        _discountLab.hidden = YES;
    }else{
        _detailLab.hidden = _tipLab.hidden = YES;
        _discountLab.hidden = NO;
    }
}
#pragma mark - getter methods

- (UILabel *)titleLab{
    
    if (!_titleLab) {
        _titleLab = [UILabel makeLabelWithText:@"" textColor:UIColorFromRGB(0x262626) font:mFont(16) textAliment:0];
    }
    return _titleLab;
}

- (UILabel *)detailLab{
    
    if (!_detailLab) {
        _detailLab = [UILabel makeLabelWithText:@"" textColor:UIColorFromRGB(0x999999) font:mFont(13) textAliment:2];
        _detailLab.hidden = YES;
    }
    return _detailLab;
}

- (UILabel *)tipLab{
    
    if (!_tipLab) {
        _tipLab = [UILabel makeLabelWithText:@"费用可多个阶段选择" textColor:UIColorFromRGB(0x999999) font:mFont(12) textAliment:0];
        _tipLab.hidden = YES;
    }
    return _tipLab;
}

- (UILabel *)discountLab{
    
    if (!_discountLab) {
        _discountLab = [UILabel makeLabelWithText:@"85折优惠" textColor:UIColorFromRGB(0xFF8A00) font:mFont(16) textAliment:0];
        _discountLab.hidden = YES;
    }
    return _discountLab;
}



@end
